<?php

namespace App\Http\Controllers;

use App\Message;
use Illuminate\Http\Request;

use App\Http\Requests;

use App\Article;

class ArticleController extends Controller
{
    //
    public function show(Request $request, $id) {
        if (preg_match("/\\/admin\\/user\\/\\d+\\/message$/", $request->header("Referer"), $matches)) {
            $message = new Message();
            $data['isread'] = 1;
            $message->where('article_id', $id)->update($data);
        }
        return view('article/show')->withArticle(Article::with('hasManyComments')->find($id));
    }
}
